﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace WP7.LockerPlayer.ViewModels
{
    public static class ViewModelTranslator
    {
        public static void Translate<ModelT, ViewModelT>(ObservableCollection<ModelT> modelCollection, IList<ViewModelT> viewModelCollection, Action<ModelT,ViewModelT> translateRule)
        {
            viewModelCollection.Clear();
            foreach (ModelT item in modelCollection)
            {
                ViewModelT vm = Activator.CreateInstance<ViewModelT>();
                translateRule(item, vm);
                viewModelCollection.Add(vm);
            }
        }
    }
}
